<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>Cabinet Admin</title>
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0"/>
    <meta name="format-detection" content="telephone=no">
    <!--<script type="text/javascript" src="js/adaptive.js"></script>-->
    <META HTTP-EQUIV="pragma" CONTENT="no-cache">
    <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
    <META HTTP-EQUIV="expires" CONTENT="0">
    <link rel="stylesheet" href="../element-ui/index.ml.css">
    <script type="text/javascript" src="../js_code/jquery-3.6.1.min.js?v=2"></script>
    <script type="text/javascript" src="../element-ui/vue.js"></script>
    <!-- import JavaScript -->
    <script type="text/javascript" src="../element-ui/index.en.js"></script>

    <script src="../js_code/underscore-min.js"></script>
    <script src="../js_code/jquery-3.6.1.min.js"></script>
    <script src="../js_code/iotauth.js"></script>
    <script src="../js_code/kddemo.js"></script>
    <script>
        function refresh2() {
            window.location.reload();
        }
    </script>
    <style>
        .box-card {

            display: inline-block;
        }
    </style>
</head>
<body class="big_show">

<div style="display: none">
    <input id="base_url" value="https://api.bestwond.com" style="width: 200px;border-radius: 5px;">
    <input id="app_id" value="bw_de2767d821f911e" style="width: 200px;border-radius: 5px;">
    <input id="device_number" value="2100014470" style="width: 200px;border-radius: 5px;">
    <input id="app_secret" value="de27690e21f911eda66200163e198b20" style="width: 200px;border-radius: 5px;">

    <button onclick="kd.get_device_list()">Get Device List</button>
</div>
<div id="app"
     class="screen_app">
    <el-row>
        <el-col :span="11">
            <el-row>
                <h2>Device number: {{device_number}} </h2>
                <el-card class="box-card" style="width: 800px;height: 300px;">
                    <div slot="header" class="clearfix">
                        <h2> Step 1. Set api for get box status</h2>
                    </div>
                    <el-form ref="form" :model="form" label-width="180px">
                        <el-form-item label="call_ad:">
                            <el-input v-model="call_ad" style="width:520px;">
                            </el-input>
                        </el-form-item>

                        <el-form-item>
                            <el-button @click="set_device_get_box_door_open_ad()" type="success"
                                       style="margin-top: 5px;height:60px;width: 160px;font-weight: bolder;font-size: 25px;">
                                Confirm
                            </el-button>
                        </el-form-item>
                    </el-form>
                </el-card>
            </el-row>

            <el-row>
                <el-card class="box-card" style="width: 800px;height: 300px;">
                    <div slot="header" class="clearfix">
                        <h2> Step 2. Get box door open or close status</h2>
                    </div>
                    <el-form ref="form" :model="form" label-width="180px">
                        <el-form-item label="Lock address:">
                            <el-input v-model="lock_address" style="width:320px;">
                            </el-input>
                        </el-form-item>
                        <el-form-item>
                            <el-button @click="get_device_box_door_open_status()" type="success"
                                       style="margin-top: 20px;height:60px;width: 160px;font-weight: bolder;font-size: 25px;">
                                Confirm
                            </el-button>
                        </el-form-item>
                    </el-form>
                </el-card>
            </el-row>
        </el-col>
        <el-col :span="12">
            <h2>Device {{device_number}} API Result</h2>
            <el-card class="box-card" style="width: 600px;height: 460px;background-color: black;color:white;">
                <div slot="header" class="clearfix">
                    Terminal
                </div>
                {{api_data}}
            </el-card>
        </el-col>
    </el-row>
</div>
</body>

<script>

    bw = new Vue({
        el: '#app',
        data: {
            form: {},
            device_number: "2100014470",
            notice_email: "",
            loading: false,
            call_ad: "https://dngdev.bestwond.com/api/iot/device/callback/for/box/status/",
            lock_address: "",
            api_data: ""
        },
        created: function () {

        },
        methods: {
            set_device_get_box_door_open_ad: function () {
                this.api_data = kd.set_device_box_call_ad(this.device_number, this.call_ad);
            },
            get_device_box_door_open_status: function () {
                this.api_data = kd.get_device_box_open_status(this.device_number, this.lock_address);
            }
        }
    });
</script>
</html>
